<link rel="stylesheet" type="text/css" media="screen" href="/css/apartamente.css" />

<?php $apartamente = $apartamente->getRawValue(); ?>

<div class="target">

    <?php if ( count($apartamente) == 0 ) : ?>

        <div class="error">Nici un apartament nu este înregistrat în sistem. Accesaţi secţiunea <a href="<?php echo url_for('apartamente/index') ?>">Apartamente</a> pentru a înregistra apartamentele din cadrul asociaţiei.</div>

    <?php else : ?>

        <div class="bloc-container">
            <div class="bloc">Blocuri:</div>
            <div class="scara">Scări:</div>
        </div>

        <?php foreach ( $apartamente as $blocName => $bloc ) : ?>

        <div class="bloc-container">

            <div class="bloc">
                <div class="bloc-item item" unselectable="on"><?php echo $blocName ?></div>
            </div>

            <div class="scara">
                <?php foreach ( $bloc as $scaraName => $scara ) : ?>
                <div class="scara-item-container ui-helper-clearfix">

                    <div class="scara-item item" unselectable="on"><?php echo $scaraName ?></div>
                    <div class="switch" unselectable="on"></div>
                    <div class="apartamente-container">
                        <div class="apartamente-popup">
                            <table>
                                <?php foreach ($scara as $etajName => $etajApartamente) : ?>
                                <tr class="etaj-row">
                                    <td>
                                        <div class="etaj-item item" unselectable="on">
                                            <?php echo $etajName ?>:
                                        </div>
                                    </td>
                                    <?php foreach ( $etajApartamente as $numarApartament => $apartament ) : ?>
                                    <td>
                                        <div class="apartament-item item" unselectable="on" title="<?php echo $apartament['PROPRIETAR'] ?>" value="<?php echo $apartament['APARTAMENT_ID'] ?>"><?php echo $numarApartament ?></div>
                                    </td>
                                    <?php endforeach; ?>
                                </tr>
                                <?php endforeach; ?>
                            </table>
                        </div>
                    </div>

                </div>
                <?php endforeach; ?>
            </div>

        </div>
        <?php endforeach; ?>

    <?php endif; ?>

</div>